package com.jiayu.seckilldemo.config;

import com.jiayu.seckilldemo.pojo.User;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：jiayu
 * @description：通用接口限流配置
 * @date ：2022/7/28 17:13
 */

public class UserContext {

    //用到threadLocal
    private static ThreadLocal<User> userHolder = new ThreadLocal<>();

    public static void setUser(User user) {
        userHolder.set(user);
    }

    public static User getUser() {
        return userHolder.get();
    }
}
